home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / genetk / read.me < prev    next >
Encoding:
Text File  |  1993-06-28  |  10.0 KB  |  235 lines

  1.  
  2.  
  3.  (c) Copyright 1993 Toms Computer Solutions, Inc. All rights reserved.
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. --------------------- Genetic Algorithms------------------------------------
  12.  
  13.  
  14.  
  15.  Genetic algorithms can be used to solve a large class of
  16. problems. The general approach is that a population of random
  17. solutions is generated. Each element of this population is given
  18. a score. A higher score indicates a better solution. Some of the
  19. solutions with lower scores are dropped from the population.
  20. They are replaced by new solutions that are created by mating.
  21. Mating is the process of combining properties from a pair of the
  22. more successful, higher scoring, elements (the parents)
  23. resulting in a new element (the offspring).
  24.  
  25.  
  26.  
  27. Randomly selected elements of the population are subjected to
  28. mutation or random changes to their properties. Just as mating
  29. causes new combinations of properties, mutation causes new
  30. properties to be introduced that were not previously found in
  31. the population.
  32.  
  33. This process of introducing new properties and combinations of
  34. properties, along with the removal of the less successful
  35. elements results in the evolution of more successful solutions.
  36. This process can be repeated for many generations until a
  37. satisfactory solution is evolved.
  38.  
  39.  
  40.  
  41. Does it work? The fact that you are intelligent enough to read
  42. this would indicate that in fact it does work! The process
  43. described above is very similar to biological genetics, natural
  44. selection and evolution that have resulted in yourself and all
  45. other forms of life on Earth. Genetic Algorithms have been
  46. referred to as "God's Algorithms".
  47.  
  48.  
  49.  
  50. Whether or not you agree with this, you may find that genetic
  51. algorithms are a useful tool for optimizing parameters and
  52. solving other problems.
  53.  
  54.  
  55.  
  56. ------- Problems that can be Solved with Genetic
  57. Algorithms-----------------
  58.  
  59.  
  60.  
  61.  In order for a problem to be solved on a computer with a
  62. genetic algorithm it must meet two criteria.
  63.  
  64.  
  65.  
  66. First it must be possible to represent a solution to the problem
  67. in a series of binary bits. This is not a difficult criterion
  68. since text, integers and floating point numbers can all be
  69. represented as series of binary bits. Computer programs and data
  70. files can be represented as a series of binary bits. Even things
  71. like colors, graphic images, and equations can be represented as
  72. a series of binary bits. It could be argued that, with fuzzy
  73. logic, properties like hot, warm, cold, pretty, nice, good and
  74. bad, could all be represented as a series of binary strings.
  75.  
  76.  
  77.  
  78. The second criterion is more difficult. For the genetic
  79. algorithm to work it must be possible to create a scoring
  80. function that will return a score when it is passed a series of
  81. binary bits that represent a solution. This means that a problem
  82. like the Traveling Salesman Problem could be worked on because a
  83. function that returns a score could be easily written. The score
  84. would be based on the total distance that the salesman had to
  85. travel. A problem like "What strategy is good for buying and
  86. selling Municipal Bonds or Deutsche Mark futures?"  could also
  87. be worked on with a score based on how much money was made or
  88. lost with a given strategy. There are some problems for which it
  89. would be difficult to write such a scoring function. Solutions
  90. to the problem of "What is a good philosophy of life?" could
  91. possibly be represented as series of binary bits in a large text
  92. file (or possibly a short text file) but it would be difficult
  93. to create a function that would score the different philosophies.
  94.  
  95.  
  96.  
  97. Other issues are also important for practical use of genetic
  98. algorithms. The time required to run the scoring function is
  99. very important. For example if you are trying to evolve a
  100. solution for "What is a good strategy for playing chess?" you
  101. might create a scoring function that requires that an entire
  102. game of chess be played. if this scoring function takes an hour
  103. to run and your population has 500 elements, then it would take
  104. more than 20 days to score each generation of your population.
  105. It might well take thousands or more generations meaning that
  106. the evolution of a good solution might take many human
  107. lifetimes. Always try to optimize the scoring function to run as
  108. fast as possible. Also run Genetic algorithms on the fastest
  109. machines possible. You may find that one good use of genetic
  110. algorithms is that they can be used to justify the purchase of
  111. the latest and fastest computer! Genetic algorithms are very
  112. well suited to multiprocessor machines or even massively
  113. parallel systems.
  114.  
  115.  
  116.  
  117. Another important issue for use of genetic algorithms is the
  118. selection of the scoring function. The scoring functions should
  119. reflect small improvements in the solutions. Otherwise the
  120. evolution will be very slow. For example  you could score a
  121. chess playing algorithm with a one for wins and a zero for
  122. losses. The problem with this is that a genetic algorithm will
  123. have no way of knowing whether a  subtle change in the strategy
  124. was good or bad. A different scoring algorithm that gave points
  125. at the end of the game, for the ratio of black to white pieces
  126. and gave points for the number of turns it took to win or lose,
  127. combined with a large number of points for actually winning
  128. might be better. In this case a slightly better strategy could
  129. be recognized and that line of evolution encouraged by the
  130. genetic algorithm. A good example of this is the first demo
  131. program, STRDEMO.BAT. Here the genetic algorithm attempts to
  132. find the solution string "Genetic algorithm at work!". One
  133. scoring function could be to simply add a minus one for every
  134. wrong letter. A better scoring algorithm is based on how wrong
  135. the letter is. For example if the target letter is a "C", then
  136. an "A" would be scored as a minus two, and a "B" would be scored
  137. as a minus one and "C" would be scored as a zero. This gives the
  138. genetic algorithm more information than just minus one for each
  139. wrong letter. It allows it to improve gradually on the solution
  140. string. It could be argued that the STRDEMO is a very contrived
  141. problem since the scoring algorithm knows what the target string
  142. is and creates a score by directly comparing it with the genetic
  143. solutions. I have used it anyway because it is a simple example
  144. that the reader may want to use to develop their own problems
  145. for the genetic algorithm to solve.
  146.  
  147.  
  148.  
  149. The second example is not so contrived. CITYDEMO is an example
  150. of the genetic algorithm being used to solve the famous
  151. traveling salesperson problem. The problem itself is simple. A
  152. salesperson needs to travel to n cities and then return to  his
  153. or her own home town. He or she must go to each and every city
  154. once and only once. The problem is to determine the route that
  155. will minimize the total travel distance. (Another problem is to
  156. maximize the total distance. Presumably his company is paying
  157. the expenses, and the salesperson is trying to get enough
  158. frequent flier miles to take his family to Hawaii!) It is
  159. generally believed (but not proven) that the only way to find
  160. the absolute shortest path is through an exhaustive search of
  161. all routes. This becomes unfeasible as the number of cities
  162. increases. Here the genetic algorithm comes up with
  163. progressively better solutions. It may eventually come up with
  164. the best possible solution but this is not certain. Hopefully an
  165. acceptable solution should eventually evolve. CITYDEMO will take
  166. a lot longer to run than STRDEMO. The early solutions are not
  167. likely to be good, but after an hour or two the genetic
  168. algorithm should evolve a solution that is better. Unfortunately
  169. the evolution process seems to be fast at first when it is easy
  170. to improve on bad solutions. Later as the solutions improve the
  171. algorithm appears to slow down. Readers with lots of patience
  172. may want to leave their machines running overnight to achieve
  173. better solutions. Even after the solution seems to be stabilized
  174. leaving the system running for a couple of days (with the
  175. cooperation of your local power company) may result in further
  176. improvement.
  177.  
  178.  
  179.  
  180. The third example FINDEMO is not included with this version and
  181. is only provided to users who send me the $39 registration fee.
  182. (Hey, my kids have to eat!)  It uses the genetic algorithm to
  183. evolve a system of buy and sell signals for financial
  184. instruments like stocks, bonds and commodities. The user
  185. provides the system with files of information about the previous
  186. performance of the instrument. The system then evolves a trading
  187. system based on the historical data. Of course there are no
  188. guarantees of future success but in fact the results with  paper
  189. trading have been extremely interesting. This is a very
  190. interesting example of the use of genetic algorithms, because
  191. the problem itself may not be well defined but it can be scored
  192. easily. The score is simply how much money the system wins or
  193. loses. It is also interesting because it is an example of a
  194. problem that is constantly changing. A good investment strategy
  195. for one year may not work in another year. These types of
  196. problems are often good candidates for solution with genetic
  197. algorithms. In the same way that changes in the physical
  198. environment may cause different organisms to evolve, changes in
  199. the financial environment will cause different investment
  200. strategies to evolve.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  Users can send the $39 registration fee to:
  209.  
  210.  
  211.  
  212. Tom's Computer Solutions, Inc.
  213. 21585 Toledo Road
  214. Boca Raton FL. 33433
  215.  
  216.  
  217.  
  218. Be sure to send me your name and address, so I can send you the
  219. FINDEMO example with complete documentation and a graphing
  220. program which will graph the results of the FINDEMO example. I
  221. will also include the source code GENETIC.CPP which is used to
  222. create GENETIC.OBJ, and additional documentation of the
  223. GENPARMS.TXT file.
  224.  
  225.  
  226.  
  227. If you have any problems, questions or interesting comments
  228. about this package please leave me a message on America On Line.
  229. My name is Tom Fernandez and my user ID is IMProgramr. It is my
  230. intention to support this package, so I will be very grateful to
  231. anyone who finds any problems or has suggestions on how the
  232. system can be improved.
  233.  
  234.  
  235.